<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/qs/6.13.0/qs.js"></script>
</head>

<body>
  <script>
    
    // 1.创建请求实例 
    var xhr = new XMLHttpRequest();
    // 2.打开一个连接
    var params = {
      page:1,
      pageSize:10
    }
    // 将对象转为查询字符串 qs.stringify(对象) 
    console.log(Qs.stringify(params))
    // ?page=1&pageSize=10
    xhr.open('get', 'http://121.199.0.35:8888/index/article/pageQuery?'+Qs.stringify(params));
    // 3.发送请求
    xhr.send();
    // 监听响应
    xhr.onreadystatechange = function () {
      if (xhr.readyState === 4 && xhr.status === 200) {
        var res = JSON.parse(xhr.response);
        res.data.list.forEach(function(item){
          // item {title,content}
          var dt = document.createElement('dt');
          var dd = document.createElement('dd');
          dt.innerHTML = item.title;
          dd.innerHTML = item.content;
          document.body.appendChild(dt);
          document.body.appendChild(dd);
        })
      }
    }
  </script>
</body>

</html>